import http from '../utils/http'
import type {UserInfo} from '@/model/user'

export const getUserInfo = (objectId:string)=>{
	return http.get(`/users/${objectId}`)
}


//注册请求
export const userRegister = (username:string,password:string)=>{
	return http.post('/users',{
		username,
		password
	})
}
//登录
export const userLogin = (username:string,password:string)=>{
	return http.post('/login',{
		username,
		password
	})
}
//账号信息更新接口
type UData = 'avatar'|'phone'|'name'
export const userUpdate = (objectId:string,session:string,userData:Partial<Pick<UserInfo,UData>>)=>{

	return http.put(`/users/${objectId}`,userData,{
		header:{
			'X-LC-Session':session//个别网络配置，额外携带参数
		}

	})
}
